package com.aaa.service.impl;

import com.aaa.dao.FundManagementDao;
import com.aaa.pojo.FundManagement;
import com.aaa.service.FundManagementService;
import com.github.pagehelper.PageHelper;
import com.github.pagehelper.PageInfo;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Service;

import java.math.BigDecimal;
import java.util.List;

@Service
public class FundManagementServiceImpl implements FundManagementService {
    @Autowired
    private FundManagementDao fundManagementDao;
    @Override
    public List<FundManagement> selectFund() {
        return fundManagementDao.selectFund();
    }

    @Override
    public PageInfo<FundManagement> getPayByPage(int pageNum, int pageSize) {
        PageHelper.startPage(pageNum,pageSize);//这行是重点，表示从pageNum页开始，每页pageSize条数据
        List<FundManagement> list = fundManagementDao.selectFund();
        PageInfo<FundManagement> pageInfo = new PageInfo<FundManagement>(list);
        return pageInfo;
    }

    @Override
    public Boolean addFundMoney(Integer u_id, Integer f_id,Double amount) {
        return fundManagementDao.addFundMoney(u_id, f_id,amount);
    }

    @Override
    public void addRecordMoney(Double f_amount, String type_abbreviate) {
        fundManagementDao.addRecordMoney(f_amount, type_abbreviate);
    }

    @Override
    public FundManagement selectByFid(Integer fid) {
        return fundManagementDao.selectByFid(fid);
    }
}
